import 'package:dio/dio.dart';

class ParamsInterceptor extends Interceptor {
  @override
  void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
    var params = {
      "ft_version": "ft-1.22.3",
      "ft_devicetype": "1",
      "ft_channel": "1000001",
      "ft-devicename": "demo",
      "ft_deviceversion": "1.0",
      "ft_deviceid": "d3637788142f58e7afe0a247ce3648da",
      "ft_screentype": 1,
      "sid": "d3637788142f58e7afe0a247ce3648da",
      "uid": "6000000000",
    };
    if (options.method == "GET") {
      options.queryParameters.addAll(params);
    } else if (options.method == "POST") {
      if (options.data == null) {
        Map<String, dynamic> data = {};
        data.addAll(params);
        options.data = data;
      }
      options.data.addAll(params);
    }
    super.onRequest(options, handler);
  }
}
